import {
  ElButton,
  ElInput,
  ElSelect,
  ElOption,
  ElCard,
  ElRow,
  ElCol,
  ElPagination,
  ElTable,
  ElTableColumn,
  ElInputNumber,
  ElMessage,
  ElMessageBox,
  ElEmpty,
  ElTag,
  ElCheckbox,
  ElBadge,
  ElMenu,
  ElMenuItem,
  ElDropdown,
  ElDropdownMenu,
  ElDropdownItem,
  ElAvatar,
  ElIcon,
  ElAlert,
  ElSkeleton,
  ElContainer,
  ElHeader,
  ElMain,
  ElFooter,
  ElForm,
  ElFormItem,
  ElLink,
  ElTabs,
  ElTabPane,
  ElDescriptions,
  ElDescriptionsItem,
  ElImage,
  ElTimeline,
  ElTimelineItem
} from 'element-plus';

// 导入图标
import {
  House,
  Goods,
  ShoppingCart,
  Document,
  User,
  ArrowDown,
  Setting,
  SwitchButton,
  Search,
  Refresh,
  View,
  Delete,
  Star
} from '@element-plus/icons-vue';

// 导入样式
import 'element-plus/dist/index.css';

export default {
  install(app) {
    // 注册组件
    app.component('ElButton', ElButton);
    app.component('ElInput', ElInput);
    app.component('ElSelect', ElSelect);
    app.component('ElOption', ElOption);
    app.component('ElCard', ElCard);
    app.component('ElRow', ElRow);
    app.component('ElCol', ElCol);
    app.component('ElPagination', ElPagination);
    app.component('ElTable', ElTable);
    app.component('ElTableColumn', ElTableColumn);
    app.component('ElInputNumber', ElInputNumber);
    app.component('ElEmpty', ElEmpty);
    app.component('ElTag', ElTag);
    app.component('ElCheckbox', ElCheckbox);
    app.component('ElBadge', ElBadge);
    app.component('ElMenu', ElMenu);
    app.component('ElMenuItem', ElMenuItem);
    app.component('ElDropdown', ElDropdown);
    app.component('ElDropdownMenu', ElDropdownMenu);
    app.component('ElDropdownItem', ElDropdownItem);
    app.component('ElAvatar', ElAvatar);
    app.component('ElIcon', ElIcon);
    app.component('ElAlert', ElAlert);
    app.component('ElSkeleton', ElSkeleton);
    app.component('ElContainer', ElContainer);
    app.component('ElHeader', ElHeader);
    app.component('ElMain', ElMain);
    app.component('ElFooter', ElFooter);
    app.component('ElForm', ElForm);
    app.component('ElFormItem', ElFormItem);
    app.component('ElLink', ElLink);
    app.component('ElImage', ElImage);
    app.component('ElTimeline', ElTimeline);
    app.component('ElTimelineItem', ElTimelineItem);

    // 注册图标 - 使用多词组件名避免ESLint警告
    app.component('IconHouse', House);
    app.component('IconGoods', Goods);
    app.component('IconShoppingCart', ShoppingCart);
    app.component('IconDocument', Document);
    app.component('IconUser', User);
    app.component('IconArrowDown', ArrowDown);
    app.component('IconSetting', Setting);
    app.component('IconSwitchButton', SwitchButton);
    app.component('IconSearch', Search);
    app.component('IconRefresh', Refresh);
    app.component('IconView', View);
    app.component('IconDelete', Delete);
    app.component('IconStar', Star);

    // 注册全局方法
    app.config.globalProperties.$message = ElMessage;
    app.config.globalProperties.$messageBox = ElMessageBox;

    // 注册新组件
    app.use(ElTabs);
    app.use(ElTabPane);
    app.use(ElDescriptions);
    app.use(ElDescriptionsItem);
  }
}; 